class Animal:
    def __init__(self, token):
        self.token = token

    def greet(self):
        print('Hello, I am %s.' % self.token)

class Dog(Animal):
    #1 调用父类的初始化方法
    def __init__(self, token, age):
        super(Dog, self).__init__(token)
        self.age = age
    #2 重定义父类方法中调用旧的父类方法super(Dog, self).greet()
    def greet(self):
        super(Dog, self).greet()
        print(f'I am {self.age} years old,WangWang!')


dog = Dog('dog', 1)
dog.greet()